/**
 * 更新数据
 * @param {*} db
 * @param {*} storeName
 * @param {*} data
 * @returns
 */
export function updateDB(db, storeName, data) {
  const request = db
    .transaction([storeName], 'readwrite') // 事务对象
    .objectStore(storeName) // 仓库对象
    .put(data);

  return new Promise((resolve, reject) => {
    request.onsuccess = function (ev) {
      resolve(ev);
    };

    request.onerror = function (ev) {
      resolve(ev);
    };
  });
}
